<section class="content-header">
  <!-- <h1>
        年检业务
    </h1> -->
  <ol class="breadcrumb">
    <li><a ui-sref="dashboard"><i class="fa fa-dashboard"></i>我的面板</a></li>
    <li><a ui-sref="annual">年检业务</a></li>
    <li class="active" ng-bind="current_bread"></li>
  </ol>
</section>
<section class="content">
  <form class="form-horizontal" id="annual_form">
    <div class="detail-view-header-wrapper">
      <div class="box-footer detail-view-header" ui-scrollpoint ui-scrollpoint-enabled="true" ui-scrollpoint-class="fixed">
        <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
        <button type="button" class="btn btn-info" ng-click="save()">保存</button>
      </div>
    </div>

    <div class="nav-tabs-custom">
      <ul class="nav nav-tabs">
        <li ng-class="{'active': activeTab == 0}"><a data-toggle="tab" ng-click="onTab(0)">年检信息</a></li>
        <li ng-class="{'active': activeTab == 1}"><a data-toggle="tab" ng-click="onTab(1)">订单日志</a></li>
        <li ng-class="{'active': activeTab == 2}"><a data-toggle="tab" ng-click="onTab(2)">年检日志</a></li>
      </ul>
      <div class="tab-content">
        <div class="tab-pane" ng-class="{'active': activeTab == 0}">
          <div class="form-group">
            <label class="col-sm-2 control-label">年检编号<span class="required">*</span></label>
            <div class="col-sm-8">
              <input type="text" class="form-control" ng-model="data.code" placeholder="系统自动生成" readonly>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">客户编号</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="type" ng-model="data.customer_code" disabled>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">客户名称</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="type" ng-model="data.customer_name" disabled>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">年检类别</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="order_type_name" ng-model="data.order_type_name" disabled>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">年检年份<span class="required">*</span></label>
            <div class="col-sm-8">
              <select class="form-control" name="data.start_annual" ng-model="data.start_annual" data-rule="required;">
                <option value="">请选择</option>
                <option ng-repeat="option in years" value="{{option}}">{{option}}</option>
              </select>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">订单档案号</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="order_code" ng-model="data.order_code" disabled>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">订单名称</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="name_cn" ng-model="data.name_cn" disabled>
            </div>
          </div>
          <div class="form-group" ng-if="data.name_en.length > 0">
            <label class="col-sm-2 control-label">英文名</label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="name_en" ng-model="data.name_en" disabled>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" ng-bind="getAnnDateName()"></label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="name_cn" ng-model="data.date_setup_for_ann" disabled>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">其他事项</label>
            <div class="col-sm-8">
              <textarea class="form-control" rows="3" name="description" ng-model="data.description" data-rule=" length[~300];"></textarea>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">成交日期<span class="required">*</span></label>
            <div class="col-sm-8">
              <input type="text" class="form-control date-input" id="date_transaction" name="date_transaction" ng-model="data.date_transaction" data-rule="required;">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">年检金额<span class="required">*</span></label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="amount_transaction" ng-model="data.amount_transaction" data-rule-money="[/^(([1-9]\d{0,9})|0)(\.\d{1,2})?$/, '请填写2位数的数值']" data-rule="required;money;">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">交易币别<span class="required">*</span></label>
            <div class="col-sm-8">
              <select ui-select2 class="form-control select2" name="currency" id="currencySelect2" ng-model="data.currency" url="Dictionary/DroplistByGroup" paging="false" paramfield="group" paramvalue="币别" data-rule="required;"></select>
              <span id="currencySelect2-validator" class="select-validator"></span>
            </div>
            <div class="col-sm-2 add-dictionary">
              <a class="fa fa-plus" ui-sref=".dictionary({group: '币别'})" ui-sref-opts="{location:false}" title="添加币别"></a>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">汇率<span class="required">*</span></label>
            <div class="col-sm-8">
              <input type="text" class="form-control" name="rate" ng-model="data.rate" data-rule-money="[/^(([1-9]\d{0,9})|0)(\.\d{1,2})?$/, '请填写2位数的数值']" data-rule="required;money;">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">年检客服<span class="required">*</span></label>
            <div class="col-sm-8">
              <select ui-select2 class="form-control select2" id="waiterSelect2" name="waiter_id" ng-view="waiter_name" ng-model="data.waiter_id" url=" Member/List" paging="true" style="width: 100%;"></select>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">客户归属</label>
            <div class="col-sm-8" ng-bind="data.salesman" style="line-height: 30px;">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">订单归属</label>
            <div class="col-sm-8" ng-bind="data.order_owner" style="line-height: 30px;">
            </div>
          </div>
          <!-- <div class="form-group">
            <label class="col-sm-2 control-label">助理</label>
            <div class="col-sm-8">
              <select ui-select2 class="form-control select2" id="assistantSelect2" name="assistant_id" allowclear="true" ng-view="assistant_name" ng-model="data.assistant_id" url=" Member/List" paging="true" style="width: 100%;"></select>
            </div>
          </div> -->
          <!-- <div class="form-group">
            <label class="col-sm-2 control-label">会计</label>
            <div class="col-sm-8">
              <select ui-select2 class="form-control select2" id="accountantSelect2" name="accountant_id" allowclear="true" ng-view="accountant_name" ng-model="data.accountant_id" url="Member/List" paging="true" style="width: 100%;"></select>
              <span id="accountantSelect2-validator" class="select-validator"></span>
            </div>
          </div> -->
        </div>
        <div class="tab-pane" ng-class="{'active': (activeTab == 1 || activeTab == 2)}">
            <ul class="timeline">
              <li ng-repeat="item in timelines.items">
                <i class="fa fa-clock-o bg-blue"></i>
                <div class="timeline-item">
                  <span class="time">
                    <i class="fa fa-user" ng-if="item.creator"></i>
                    <span ng-if="item.creator" ng-bind="item.creator" style="margin-right: 10px;"></span>
                    <i class="fa fa-clock-o"></i>
                    <span ng-bind="format(item.date_created, 'YYYY-MM-DD HH:mm:ss')"></span>
                  </span>
                  <h3 class="timeline-header">
                    <a href="javascript:;" ng-bind="getTitle(item)"></a>
                  </h3>
                  <div class="timeline-body">
                    <span ng-if="item.is_system == '0'" ng-bind="(item.log_type == 1  ? '待办日期：' : '日期：') + format(item.date_business, 'YYYY-MM-DD')"
                      style="margin-right: 10px;"></span>
                    <span ng-bind="(item.is_system == '0'  ? '内容：' : '') + item.content"></span>
                  </div>
                  <!-- <div class="timeline-footer" ng-if="item.is_system == '0'">
                    <a class="btn btn-primary btn-xs" ui-sref=".edit({tid: {{item.id}}})" ui-sref-opts="{location:false}">修改</a>
                    <a class="btn btn-danger btn-xs" ng-click="delete(item)">删除</a>
                  </div> -->
                </div>
              </li>
            </ul>
  
            <div ng-if="!timelines.items.length">
              暂无数据
            </div>
        </div>
      </div>
    </div>
        
    <!-- <div class="box-header with-border">
      <h3 class="box-title">年检信息</h3>
      <div class="box-tools">
        <div class="box-tools pull-right">
          <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
          </button>
        </div>
      </div>
    </div>
    <div class="box-body">
    </div> -->

    <div class="box box-danger" style="padding-bottom: 60px;">
      <div class="box-header with-border">
        <h3 class="box-title">客户信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <a href="javascript:;" class="col-sm-2 control-label" ng-click="showCustomerInfo()" ng-if="customerInfo==null">显示客户信息</a>
        </div>
        <div ng-if="customerInfo != null">

          <div>
            <div class="box-body no-padding">
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">客户名称:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.name"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">详细地址:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.province + customerInfo.city + customerInfo.county + customerInfo.address"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">寄件地址:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.mailling_province + customerInfo.mailling_city + customerInfo.mailling_county + customerInfo.mailling_address"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">传真:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.fax"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">业务员:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.salesman"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">助理:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.assistant_name"></span>
                </div>
              </div>
            </div>
            <div class="box-footer clearfix">
              <button type="button" class="btn btn-info" ui-sref=".customer_edit({customer_id: customerInfo.id})" ui-sref-opts="{location:false}">编辑客户资料</button>
            </div>
          </div>

          <div>
            <div class="box-header with-border">
              <h3 class="box-title">联系人</h3>
            </div>
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tbody>
                  <tr>
                    <th style="width: 10px">#</th>
                    <th>联系人</th>
                    <th>对接事务</th>
                    <th>手机</th>
                    <th>座机</th>
                    <th>职务</th>
                    <th>邮箱</th>
                    <th>微信</th>
                    <th>QQ</th>
                    <th>备注</th>
                    <th class="opt-col">操作</th>
                  </tr>
                  <tr ng-repeat="item in customerInfo.contactList">
                    <td ng-bind="($index+1)+'.'"></td>
                    <td ng-bind="item.name"></td>
                    <td ng-bind="item.responsable"></td>
                    <td ng-bind="item.mobile"></td>
                    <td ng-bind="item.tel"></td>
                    <td ng-bind="item.position"></td>
                    <td ng-bind="item.email"></td>
                    <td ng-bind="item.wechat"></td>
                    <td ng-bind="item.QQ"></td>
                    <td ng-bind="item.memo"></td>
                    <td class="opt-col">
                      <a href="javascript:;" class="fa fa-pencil orange" ng-click="editContact($index, item)" title="修改"></a>
                    </td>
                  </tr>
                </tbody>
              </table>
              <div ng-if="!customerInfo.contactList.length" style="padding: 20px; font-size: 14px;">
                无联系人资料
              </div>
            </div>
            <div class="box-footer clearfix">
              <button type="button" class="btn btn-info" ui-sref=".contact_add({customer_id: customerInfo.id})" ui-sref-opts="{location:false}">新增联系人</button>
            </div>
          </div>
          <div>
            <div class="box-header with-border">
              <h3 class="box-title">在我司业务</h3>
            </div>
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tbody>
                  <tr>
                    <th style="width: 10px">#</th>
                    <th>订单类型</th>
                    <th>档案号</th>
                    <th>订单名称</th>
                    <th>英文名</th>
                    <th>订单状态</th>
                    <th>注册时间</th>
                    <!-- <th>录入时间</th> -->
                  </tr>
                  <tr ng-repeat="item in customerOrders">
                    <td ng-bind="($index+1)+'.'"></td>
                    <td ng-bind="item.order_type_name"></td>
                    <td ng-bind="item.order_code"></td>
                    <td ng-bind="item.order_name" ng-attr-title="{{item.order_name}}"></td>
                    <td ng-bind="item.order_name_en" ng-attr-title="{{item.order_name_en}}"></td>
                    <td ng-bind="getStatus(item)"></td>
                    <td ng-bind="format(item.date_setup, 'YYYY-MM-DD')"></td>
                    <!-- <td ng-bind="format(item.date_created, 'YYYY-MM-DD HH:MM')"></td> -->
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </form>
</section>
<div ui-view="modal"></div>
